Basic use cases of redis in PHP and redisPHP. The basic use cases of redis in PHP, and the use cases of redisPHP download www. oschina. after netpredis is decompressed, it contains the lib source file, examples example, and test the basic use case
Php connection to redis database predis operations Daquan
Predis is the php database for connecting to redis. because it is fully written in php and uses a lot of namespace and closure functions, it only supports php5.3 and later versions,
Use AutoLoad to load related libraries, this point is to require $file; Spl_autoload_register (function ($class) {$file = __dir__. ' /lib/predis/'. $class.
PHP ';
if (file_exists ($file)) {require $file; return true;}});
Configure the connected IP,
Introduced
Redis is a key-value storage system. Like memcached, it supports a relatively larger number of stored value types, including string (string), list (linked list), set (set), Zset (sorted set– ordered set), and hash (hash type). These data
Use AutoLoad to load the relevant library, this is the key torequire$file; Spl_autoload_register (function ($class) {$file = __dir__. ' /lib/predis/'. $class. PHP '; if (file_exists ($file)) {require $file; return true;}); /Configure the connected
Predis is the PHP connection Redis Operation Library, because it completely uses PHP writing, a lot of use of namespaces and closures and other functions, only support php5.3 above, so the measured performance, 25,000 times per second read and write.
Download Http://www.oschina.net/p/redisAfter decompression, there are: Lib source files, examples examples, test testsCopy the Lib directory to your project and you can start your Predis operation.Use AutoLoad to load the relevant library, the focus
1. Problems with the mysql+memcached architecture
The actual MySQL is suitable carries on the massive data storage, through memcached hot spot data loading to the cache, speeds up the visit, many companies have used this kind of architecture, but
Php-redis help manual _ set related _ sAdd_sRem_sRemove_sMove_s .... Set data type-related operations in Redis, we can view the Set type as a character set without sorting, the same as the List type, you can also add or set data types on the data
Redis is also known as caching1.redis是一个key-value存储系统,没有ForeignKey和ManyToMany的字段.2.在redis中创建的数据彼此之间是没有关系的,所以也被称为是非关系型数据库3.它支持存储包括string(字符串)、list(链表)、set(集合)、zset(sorted set
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.